/*
 * @Copyright: 2017 www.yyfax.com Inc. All rights reserved.
 */
package com.yyfax.pay.order.data.service;

import com.yyfax.pay.order.model.po.AuthOrderPO;
import com.yyfax.pay.order.model.po.PayOrderPO;

/**
 * 独立鉴权订单服务接口
 *
 * @author buyi
 * @date 2017-04-12 11:09:15
 * @since 1.0.0
 */
public interface AuthOrderService {
	/**
	 * 根据主键查询实体
	 *
	 * @author buyi
	 * @date 2017年4月3日上午1:28:16
	 * @since 1.0.0
	 * @param id 主鍵
	 * @param merchantCode 商户编号(分表预留参数)
	 * @return
	 * @throws Exception
	 */
	public AuthOrderPO queryByIdAndMerchantCode(int id, String merchantCode) throws Exception;

	/**
	 * 保存实体对象
	 *
	 * @author buyi
	 * @date 2017年4月3日上午1:28:22
	 * @since 1.0.0
	 * @param po 实体对象
	 * @return 返回主鍵，如果返回-1,0表示失败
	 * @throws Exception
	 */
	public int save(AuthOrderPO po) throws Exception;

	/**
	 * 查询订单
	 * 
	 * @author buyi
	 * @date 2017-04-15 16:59:14
	 * @since v1.0.0
	 * @param orderId 商户订单号
	 * @param merchantCode 商户号
	 * @return
	 */
	public AuthOrderPO queryByOrderIdAndMerchantCode(String orderId, String merchantCode);

	/**
	 * 保存订单信息，并返回业务主键
	 * 
	 * @author buyi
	 * @date 2017-04-15 17:11:30
	 * @since v1.0.0
	 * @param orderPO
	 * @return
	 * @throws Exception
	 */
	public String saveAndReturnBusiKey(AuthOrderPO orderPO) throws Exception;

	/**
	 * 更新订单信息
	 * 
	 * @author buyi
	 * @date 2017-04-19 18:32:46
	 * @since v1.0.0
	 * @param authOrderPO
	 * @return
	 * @throws Exception 
	 */
	public int modify(AuthOrderPO authOrderPO) throws Exception;
	
	/**
	 * 更新用户鉴权订单状态
	 * 
	 * @author buyi
	 * @date 2017-12-25 09:46:38
	 * @since v2.0.5
	 *
	 * @param authOrderPO
	 * @return
	 * @throws Exception
	 */
	public int modifyState(AuthOrderPO authOrderPO) throws Exception;
}
